﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using BarcodeLib;
using System.Windows.Forms;
using System.Drawing.Printing;

namespace CES_Application
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public Form1( Form1 f)
        {
            InitializeComponent();
        }


        private void brunoToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            /*this.IsMdiContainer = true;
            Form2 fm = new Form2();
            fm.MdiParent = this;
            fm.Show();*/
        }

        private void Form1_Load(object sender, EventArgs e)
        {
           Barcode b = new Barcode();
           b.IncludeLabel = true;
           pictureBox1.Image = b.Encode(TYPE.UPCA,
          "038000356216", Color.Black, Color.White, 400, 100);  


           pictureBox1.Width = pictureBox1.Image.Width;
           pictureBox1.Height = pictureBox1.Image.Height;
          
        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            PrintDocument pd = new PrintDocument();
            pd.PrintPage += new PrintPageEventHandler(imprimir);
            pd.Print();
        }


        public void imprimir(object o, PrintPageEventArgs e)
        {
            System.Drawing.Image i = pictureBox1.Image;
            //local de impressão 50 x, 50 y.
            e.Graphics.DrawImage(i, 50, 50);
        }


    }
}
